import 'package:dk_flutter_module_sale/common/plugin/bean/bean_record_video.dart';

///房间类型
enum RoomEnvironmentType {
  RoomEnvironmentTypeOut,//公寓外部
  RoomEnvironmentTypeCommon,//公寓公共区域
  RoomEnvironmentTypeInner//公寓房间内部
}

class AreaDataBean {
  List<AreaBean> areas;

  AreaDataBean({this.areas});

  AreaDataBean.fromJson(Map<String, dynamic> json) {
    if (json['areas'] != null) {
      areas = new List<AreaBean>();
      json['areas'].forEach((v) {
        areas.add(new AreaBean.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.areas != null) {
      data['areas'] = this.areas.map((v) => v.toJson()).toList();
    }
    return data;
  }
}


//区域部分
class AreaBean {
  String areaType;
  bool flag;
  String areaName;
  String roomCode;
  List<Url> url;
  RoomEnvironmentType enType;//环境类型
  RecordVideoResultBean recordVideoResultBean;

  AreaBean({this.areaType, this.flag, this.areaName, this.url,this.roomCode});

  AreaBean.fromJson(Map<String, dynamic> json) {
    areaType = json['areaType'];
    switch(areaType) {
      case "1":{
        this.enType = RoomEnvironmentType.RoomEnvironmentTypeOut;
        break;
      }
      case "2":{
        this.enType = RoomEnvironmentType.RoomEnvironmentTypeCommon;
        break;
      }
      case "3":{
        this.enType = RoomEnvironmentType.RoomEnvironmentTypeInner;
        break;
      }
    }
    flag = json['flag'];
    roomCode = json["roomCode"];
    areaName = json['areaName'];
    if (json['url'] != null) {
      url = new List<Url>();
      json['url'].forEach((v) {
        url.add(new Url.fromJson(v));
      });
    } else {
      url = [];
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['areaType'] = this.areaType;
    data['flag'] = this.flag;
    data['areaName'] = this.areaName;
    data['roomCode'] = this.roomCode;
    if (this.url != null) {
      data['url'] = this.url.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

//视频部分
class Url {
  int timeConsuming;
  int size;
  String videoUrl;
  bool isDelete;
  String imageUrl;
  int id;

  Url(
      {this.timeConsuming,
      this.size,
      this.videoUrl,
      this.isDelete,
      this.imageUrl,
      this.id});

  Url.fromJson(Map<String, dynamic> json) {
    timeConsuming = json['timeConsuming'];
    size = json['size'];
    videoUrl = json['videoUrl'];
    isDelete = json['isDelete'];
    imageUrl = json['imageUrl'];
    id = json['id'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['timeConsuming'] = this.timeConsuming;
    data['size'] = this.size;
    data['videoUrl'] = this.videoUrl;
    data['isDelete'] = this.isDelete;
    data['imageUrl'] = this.imageUrl;
    data['id'] = this.id;
    return data;
  }
}
